﻿namespace WebServiceExtensions.Configurations.LogExtension
{
    using System;
    using System.ComponentModel;
    using System.Configuration;

    using WebServiceExtensions.Configurations.Common;

    /// <summary>
    /// Represents Custom logger type
    /// </summary>
    public class Custom : ConfigurationElement
    {
		#region Fields (2) 

        /// <summary>
        ///   The type property.
        /// </summary>                                                                                                   s
        private const string OutputProperty = "output";

        /// <summary>
        ///   The type property.
        /// </summary>
        private const string TypeProperty = "type";

		#endregion Fields 

		#region Constructors (2) 

        /// <summary>
        /// Initializes a new instance of the <see cref="Custom"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="outputType">Type of the output.</param>
        public Custom(Type type, OutputType outputType)
        {
            this.Type = type;
            this.OutputType = outputType;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Custom"/> class. 
        /// </summary>
        public Custom()
        {
        }

		#endregion Constructors 

		#region Properties (2) 

        /// <summary>
        /// Gets or sets the type of the output.
        /// </summary>
        /// <value>The type of the output.</value>
        [ConfigurationProperty(OutputProperty, IsRequired = true)]
        public OutputType OutputType
        {
            get
            {
                return (OutputType)base[OutputProperty];
            }

            set
            {
                base[OutputProperty] = value;
            }
        }

        /// <summary>
        ///   Gets or sets the type.
        /// </summary>
        /// <value>The type.</value>
        [TypeConverter(typeof(StringToTypeConverter))]
        [ConfigurationProperty(TypeProperty, IsRequired = true)]
        public Type Type
        {
            get
            {
                return (Type)base[TypeProperty];
            }

            set
            {
                base[TypeProperty] = value;
            }
        }

		#endregion Properties 
    }
}
